package com.example.carbonbackend.controller;


import com.example.carbonbackend.common.BaseResponse;
import com.example.carbonbackend.service.OssUploadService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
@Slf4j
public class  UploadController {

    @Autowired
    private OssUploadService ossUploadService;

    @PostMapping("/upload")
    public BaseResponse uploadImg(MultipartFile file) throws IOException {
        log.info("文件信息：{}",666);
        log.info("文件信息：{}",file.getName());
        return ossUploadService.uploadFile(file);

    }

}
